package com.aspose.cells.a.d;

import java.util.HashMap;
import java.util.Iterator;

public class zes {
   private zdh a;
   private com.aspose.cells.b.a.a.zd b = new com.aspose.cells.b.a.a.zd();
   private com.aspose.cells.b.a.a.zd c = new com.aspose.cells.b.a.a.zd();
   private com.aspose.cells.b.a.a.zd d = new com.aspose.cells.b.a.a.zd();
   private com.aspose.cells.b.a.a.zd e = new com.aspose.cells.b.a.a.zd();
   private com.aspose.cells.b.a.a.zd f = new com.aspose.cells.b.a.a.zd();
   private HashMap g = new HashMap();
   private HashMap h = new HashMap();
   private static HashMap i = new HashMap();

   public zes(zdh var1) {
      this.a = var1;
   }

   public int a(int var1) throws Exception {
      return this.d(var1).b();
   }

   public zdw a(String var1, int var2, boolean var3) throws Exception {
      String var4 = b(var1, var2, var3);
      com.aspose.cells.b.a.a.zd var5 = this.d(1);
      zdw var6 = (zdw)var5.d((Object)var4);
      if (var6 == null) {
         var6 = zdw.a(this.a, var1, var2, var3);
         var5.a(var4, var6);
      }

      return var6;
   }

   public zeu a(com.aspose.cells.b.a.b.zc var1) throws Exception {
      zg var2 = (zg)com.aspose.cells.b.a.zl.a(var1, zg.class);
      zeu var3 = null;
      if (var2 != null) {
         var3 = new zeu(this.a, var2);
         com.aspose.cells.b.a.a.zd var4 = this.d(5);
         var4.a(var3.p(), var3);
         return var3;
      } else {
         return null;
      }
   }

   public zeo b(com.aspose.cells.b.a.b.zc var1) throws Exception {
      if (var1 instanceof com.aspose.cells.b.a.b.a.zg) {
         String var5 = a((com.aspose.cells.b.a.b.a.zg)var1);
         if (this.h.containsKey(var5)) {
            return (zeo)this.h.get(var5);
         } else {
            zeo var6 = zeo.a(var1, this.a);
            com.aspose.cells.b.a.a.zd var4 = this.d(2);
            var4.a(var6.p(), var6);
            this.h.put(var5, var6);
            return var6;
         }
      } else {
         zeo var2 = zeo.a(var1, this.a);
         com.aspose.cells.b.a.a.zd var3 = this.d(2);
         var3.a(var2.p(), var2);
         return var2;
      }
   }

   public zdl a() throws Exception {
      zdl var1 = new zdl(this.a);
      com.aspose.cells.b.a.a.zd var2 = this.d(3);
      var2.a(var1.p(), var1);
      return var1;
   }

   public zed a(zee var1) throws Exception {
      com.aspose.cells.b.a.a.zd var2 = this.d(4);
      zed var3 = new zed(this.a, var1);
      var2.a(var3.p(), var3);
      return var3;
   }

   public zed a(zee var1, long var2) throws Exception {
      com.aspose.cells.b.a.a.zd var4 = this.d(4);
      if (!this.g.containsKey(var2)) {
         zed var5 = new zed(this.a, var1);
         this.g.put(var2, var5);
         var4.a(var5.p(), var5);
         return var5;
      } else {
         return (zed)this.g.get(var2);
      }
   }

   public void a(zeg var1) throws Exception {
      this.a(1, var1);
      this.a(5, var1);
      this.a(2, var1);
      this.a(3, var1);
      this.a(4, var1);
   }

   public void a(zeg var1, int var2) throws Exception {
      this.a(1, var1, var2);
      this.a(5, var1, var2);
      this.a(2, var1, var2);
      this.a(3, var1, var2);
      this.a(4, var1, var2);
   }

   public void b(zeg var1) throws Exception {
      this.b(1, var1);
      this.b(5, var1);
      this.b(2, var1);
      this.b(3, var1);
      this.b(4, var1);
   }

   private void a(int var1, zeg var2) throws Exception {
      com.aspose.cells.b.a.a.zd var3 = this.d(var1);
      if (var3.b() != 0) {
         var2.a("/" + b(var1));
         var2.g();
         Iterator var4 = var3.iterator();

         while(var4.hasNext()) {
            com.aspose.cells.b.a.a.za var5 = (com.aspose.cells.b.a.a.za)var4.next();
            zef var6 = (zef)var5.getValue();
            var2.a("/" + var6.p(), var6.n());
         }

         var2.h();
      }
   }

   private void a(int var1, zeg var2, int var3) throws Exception {
      com.aspose.cells.b.a.a.zd var4 = this.d(var1);
      if (var4.b() != 0) {
         boolean var5 = false;
         Iterator var6 = var4.iterator();

         com.aspose.cells.b.a.a.za var7;
         zef var8;
         while(var6.hasNext()) {
            var7 = (com.aspose.cells.b.a.a.za)var6.next();
            var8 = (zef)var7.getValue();
            if (var8.q() == var3) {
               var5 = true;
               break;
            }
         }

         if (var5) {
            var2.a("/" + b(var1));
            var2.g();
            var6 = var4.iterator();

            while(var6.hasNext()) {
               var7 = (com.aspose.cells.b.a.a.za)var6.next();
               var8 = (zef)var7.getValue();
               if (var8.q() == var3) {
                  var2.a("/" + var8.p(), var8.n());
               }
            }

            var2.h();
         }
      }
   }

   private void b(int var1, zeg var2) throws Exception {
      com.aspose.cells.b.a.a.zd var3 = this.d(var1);
      if (var3.b() != 0) {
         Iterator var4 = var3.iterator();

         while(var4.hasNext()) {
            com.aspose.cells.b.a.a.za var5 = (com.aspose.cells.b.a.a.za)var4.next();
            zef var6 = (zef)var5.getValue();
            var6.a(var2);
         }

      }
   }

   public static String b(int var0) {
      return ((zer)i.get(var0)).a;
   }

   public static String c(int var0) {
      return ((zer)i.get(var0)).b;
   }

   private static String b(String var0, int var1, boolean var2) {
      return com.aspose.cells.b.a.zv.a("{0}{1}{2}", var0, var1, var2);
   }

   private com.aspose.cells.b.a.a.zd d(int var1) throws Exception {
      switch(var1) {
      case 1:
         return this.b;
      case 2:
         return this.c;
      case 3:
         return this.d;
      case 4:
         return this.e;
      case 5:
         return this.f;
      default:
         throw new Exception("Unknown resource type.");
      }
   }

   private static String a(com.aspose.cells.b.a.b.a.zg var0) {
      StringBuilder var1 = new StringBuilder();
      var1.append(var0.d());
      var1.append("_");
      var1.append(var0.c().toArgb());
      var1.append("_");
      var1.append(var0.b().toArgb());
      return com.aspose.cells.b.a.zr.a(var1);
   }

   static {
      i.put(1, new zer("Font", "F"));
      i.put(2, new zer("Pattern", "P"));
      i.put(3, new zer("ExtGState", "GS"));
      i.put(4, new zer("XObject", "X"));
      i.put(5, new zer("Shading", "Sh"));
   }
}
